﻿using System.Windows.Controls;
using System.Windows.Navigation;

namespace QuailDashboard.View.Views
{
    /// <summary>
    /// The test results class
    /// </summary>
    public partial class TestResults
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="TestResults"/> class.
        /// </summary>
        public TestResults()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Executes when the user navigates to this page.
        /// </summary>
        /// <param name="e">unused parameter</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (!NavigationContext.QueryString.ContainsKey("testrunid"))
            {
                ChildWindow errorWin = new ErrorWindow("Missing ID", "Need the Test Run ID as an ID parameter to the page!");
                errorWin.Show();
            }
            else
            {
                TestRunLogs.TestRunId = int.Parse(NavigationContext.QueryString["testrunid"]);

                Title = "Quail Dashboard - Test Results (" + TestRunLogs.TestRunId + ")";
            }
        }
    }
}
